<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('Goods/index')}">商品列表</a></li>
			<li><a href="{:url('Goods/add')}">添加商品</a></li>
			<li class="active"><a>编辑商品</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Goods/editPost')}">
			<div class="form-group">
				<label for="thumbnail" class="col-sm-2 control-label">图像<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10">
					<input type="hidden" class="form-control" id="thumbnail" name="img" required value="{:$data.img}">
					<a href="javascript:uploadOneImage('图片上传','#thumbnail');">
						<img src="{:empty($data['img'])?'__TMPL__/public/assets/images/default-thumbnail.png':$data['img']}"
							 id="thumbnail-preview"
							 width="135" style="cursor: pointer"/>
					</a>
				</div>
			</div>
			<div class="form-group">
				<label for="input-title" class="col-sm-2 control-label">名称<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-title" name="name" required value="{:$data.name}">
				</div>
			</div>

			<div class="form-group">
				<label for="input-ratio" class="col-sm-2 control-label">价格<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10">
					<input type="number" class="form-control" id="input-ratio" name="price"  required value="{:$data.price}">
				</div>
			</div>
			<div class="form-group">
				<label for="input-ratio_id" class="col-sm-2 control-label">币值<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10">
					<select class="form-control" name="currency_id" id="input-ratio_id" required>
						<notempty name="ratio_id">
							<volist name="ratio_id" id="vo">
								<option value="{$vo.id}" {$data['currency_id']==$vo['id'] ? 'selected' : ''}>
									{$vo.title}
								</option>
							</volist>
							<else/>
							<option value="">你还未添加</option>
						</notempty>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="input-stock" class="col-sm-2 control-label">库存<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10">
					<input type="number" class="form-control" id="input-stock" name="stock" value="{:$data.stock}"  required>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<input type="hidden" name="id" value="{$data.id}">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
					<a class="btn btn-default" href="{:url('Goods/index')}">{:lang('BACK')}</a>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>